package com.cjkj.system.api;

import com.cjkj.common.core.constant.SecurityConstants;
import com.cjkj.common.core.constant.ServiceNameConstants;
import com.cjkj.common.core.domain.R;
import com.cjkj.system.api.domain.dto.APIWechatSessionDto;
import com.cjkj.system.api.domain.request.APIAppAccountReq;
import com.cjkj.system.api.factory.RemoteAppFallbackFactory;
import com.cjkj.system.api.model.AppletLoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteAppService",value = ServiceNameConstants.APPLET_SERVICE,fallbackFactory = RemoteAppFallbackFactory.class )
public interface RemoteAppService {

    /**
     * 获取openid
     */
    @GetMapping("/account/getOpenId")
    R<APIWechatSessionDto> getOpenId(@RequestParam("jsCode") String jsCode,
                                     @RequestParam("dataType") String dataType);
    
    /**
     * 获取登录用户信息
     */
    @GetMapping("/account/getLoginUser")
    R<AppletLoginUser> getLoginUser(@RequestParam("openid") String openid);

    /**
     * 新增用户
     */
    @PostMapping("/account")
    R<?> addAccount(@RequestBody APIAppAccountReq accountReq);

    /**
     * 清除绑定的医生信息
     * @param doctorAccount 医生账号
     */
    @GetMapping("/bind-info/clearDoctorInfo")
    R<?> clearDoctorInfo(@RequestParam("doctor") String doctorAccount, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
